<?php
/**************************************/
// World of Warcraft Armory SDK       //
// Userbars module                    //
// Licence: GNU GPLv3                 //
// Author: Giacomo 'elegos' Furlan    //
// File: templates/signX1.php         //
/**************************************/

	require_once("wowasdk/wowasdk.include.php");
	
	function template($name, $region, $realm) {
		$data = new wowasdk_character($region,$realm,$name);
		
		$level = $data->getLevel();
		$classId = $data->getClassId();
		$class = $data->getClass();
		$raceId = $data->getRaceId();
		$factionId = $data->getFactionId();
		$guild = $data->getGuildName();
		$realm = $data->getRealm();
		$nameP = $data->getNamePrefix();
		$nameS = $data->getNameSuffix();
		$name = $data->getName();
		$max = 45;
		
		$background = "bg_".$factionId.".png";
		$img_race = array (
			"source" => "race_".$raceId.".gif",
			"x" => 0,
			"y" => 0,
			"width" => 100,
			"height" => 100,
			"opacity" => 100
		);
		
		$img_class = array (
			"source" => "over_".$classId.".gif",
			"x" => 225,
			"y" => 0,
			"width" => 225,
			"height" => 100,
			"opacity" => 100
		);
		
		$img_frame = array (
			"source" => "frame.gif",
			"x" => 0,
			"y" => 0,
			"width" => 450,
			"height" => 100,
			"opacity" => 100
		);
		
		$text_name = array(
			"content" => $name,

			"font" => "MORPHEUS.TTF",
			"size" => 25,

			"red" => 255,
			"green" => 255,
			"blue" => 255,

			"x" => 100,
			"y" => 60
		);
		
		$content = $class." level ".$level;
		$font = "MORPHEUS.TTF";
		$size = 18;
		$dim = imagettfbbox($size,0,"templates/signX1/$font",$content);
		$x = 340-$dim[2];
		$text_class = array(
			"content" => $content,
			
			"font" => $font,
			"size" => $size,
			
			"red" => 0,
			"green" => 0,
			"blue" => 0,

			"x" => $x,
			"y" => 25
		);

		if($guild != "") $content = $guild." on ".$realm;
		else $content = "On ".$realm;
		$text_guild = array(
			"content" => $content,

			"font" => "MORPHEUS.TTF",
			"size" => 13,

			"red" => 255,
			"green" => 255,
			"blue" => 255,

			"x" => 150,
			"y" => 90
		);
		
		return array(
			"background" => $background,
			"images" => array(
				$img_class,
				$img_race,
				$img_frame,
			),
			"textes" => array(
				$text_name,
				$text_class,
				$text_guild,
			),
		);	
	}

?>